﻿<%@ Page MasterPageFile="~/Site.Master" Language="C#" AutoEventWireup="true" CodeBehind="OrderPriceEdit.aspx.cs" Inherits="RabbitManage.UI.OrderPriceEdit" %>


<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    
    <form id="form1" action="/Action/OrderPriceEdit.aspx?id=<%=id %>" method="POST">

    <script type="text/javascript">
        
        form1.onsubmit = function (e) {
            // stop the regular form submission
            e.preventDefault();

            // collect the form data while iterating over the inputs
            var data = {};
            for (var i = 0, ii = form1.length; i < ii; ++i) {
                var input = form1[i];
                if (input.name) {
                    data[input.name] = input.value;
                }
            }

            // construct an HTTP request
            var xhr = new XMLHttpRequest();
            xhr.open(form1.method, form1.action, true);
            xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');

            // send the collected data as JSON
            xhr.send(JSON.stringify(data));

            xhr.onloadend = function () {
                // done
                if (xhr.responseText == "true") {
                    window.location = "MyOrders.aspx";
                } else {
                    alert(xhr.responseText);
                }
            };
        };
    </script>
    
    <section class="contact">

        <h3>修改价格:</h3>
        
        <div style="border: solid;">
            <table>
                <tr>
                    <td colspan="3">
                        <%=orderViewShop.OrderInfo.OrderedAt %> &nbsp;&nbsp;&nbsp;&nbsp; 订单号： <%=orderViewShop.OrderInfo.Id %> 
                    </td>
                                
                    <td colspan="2">
                        <a href="ProductList.aspx"><%=orderViewShop.CustomerInfo.Name %></a>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        配送地址： <%=orderViewShop.OrderInfo.ShipTo.Province %> <%=orderViewShop.OrderInfo.ShipTo.City %> <%=orderViewShop.OrderInfo.ShipTo.Region %> <%=orderViewShop.OrderInfo.ShipTo.Detail %>
                    </td>
                                
                    <td colspan="2">
                        总价：<%=orderViewShop.OrderInfo.FinalPrice %>（含运费<%=orderViewShop.OrderInfo.DiliveryPrice %>）
                    </td>
                </tr>
                            
        <asp:Repeater runat="server" ID="productRepeater">
            <ItemTemplate>
                            
                <tr>
                    <td>
                        <a href="ProductDetail.aspx?id=<%#Eval("Product.ProductId") %>" target="_blank" >
                            <img alt="产品图片" width="50" src="../Images/accent.png" />
                        </a>
                    </td>
                    <td style="width: 50px;">
                        <%#Eval("Product.Name") %>
                    </td>
                    <td>
                        <%#Eval("Product.PricePerUnit") %>
                    </td>
                    <td>
                        <%#Eval("Quantity") %>
                    </td>
                    <td>
                        <%#(decimal)Eval("Product.PricePerUnit") * (int)Eval("Quantity") %>
                    </td>
                </tr>

            </ItemTemplate>
        </asp:Repeater>
            </table>
        </div>
        
        
    <table>
        <tr>
            <td>总价（含运费）修改为:</td>
            <td>
                <input type="text" id="inputTotal" name="Price" />
            </td>
        </tr>
        
<%--        <tr>
            <td>运费(元):</td>
            <td>
                <textarea id="inputPricePerUnit" name="PricePerUnit" class="me-textarea" ></textarea>
            </td>
        </tr>
        
        <tr>
            <td>毛重(kg):</td>
            <td>
                <textarea id="inputGrossWeight" name="GrossWeight" class="me-textarea" ></textarea>
            </td>
        </tr>
        
        <tr>
            <td>发货时间:</td>
            <td>
                <input readonly="readonly" type="text" class="Wdate" id="inputProductionDate" name="ProductionDate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
            </td>
        </tr>--%>
        
    </table>
        
        <input type="submit" value="提交" />
        
    </section>
    
    <script type="text/javascript">
        initCompany();
    </script>

    </form>
</asp:Content>